package com.qiall.project.data.enums;

import com.qiall.common.service.BaseEnumsService;

/**
 * @author 吴金辉
 */
public enum TaskTypeEnum implements BaseEnumsService {

    /**
     * 任务
     */
    任务((byte) 1, "任务"),

    /**
     * 缺陷
     */
    缺陷((byte) 2, "缺陷"),

    /**
     * 需求
     */
    需求((byte) 3, "需求");

    byte code;
    String desc;

    TaskTypeEnum(byte code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    @Override
    public byte getCode() {
        return code;
    }

    public static TaskTypeEnum of(Byte code) {
        for (TaskTypeEnum taskTypeEnum : TaskTypeEnum.values()) {
            if (code.equals(taskTypeEnum.code)) {
                return taskTypeEnum;
            }
        }
        return null;
    }
    public static TaskTypeEnum of(String  desc) {
        for (TaskTypeEnum taskTypeEnum : TaskTypeEnum.values()) {
            if (desc.equals(taskTypeEnum.desc)) {
                return taskTypeEnum;
            }
        }
        return null;
    }
}
